import request from "@/utils/request";

// 获取工单申请列表
export function getWorkApplyListApi(query, data) {
  return request({
    url: "/system/workOrder/list",
    method: "post",
    params: query,
    data,
  });
}

// 获取工单审核列表
export function getWorkCheckListApi(query, data) {
  return request({
    url: "/system/MaintenanceApply/checkList",
    method: "post",
    params: query,
    data,
  });
}

// 受理工单
export function getWorkOrderAffirmApi(data) {
  return request({
    url: "/system/workOrder/affirm",
    method: "post",
    data,
  });
}

// 退回工单
export function getWorkOrderBackApi(data) {
  return request({
    url: "/system/workOrder/back",
    method: "post",
    data,
  });
}

// 根据项目名查询表格信息
export function getSelectProjectInfoApi(projectId) {
  return request({
    url: "/system/project/selectProjectInfo",
    method: "get",
    params: { projectId }
  });
}

// 获取项目列表
export function getProjectListApi() {
  return request({
    url: `/system/MaintenanceApply/selectErpProjectList`,
    method: "get",
  });
}

// 新增工单申请
export function addWorkApplyApi(data) {
  return request({
    url: "/system/workOrder/add",
    method: "post",
    data,
  });
}

// 编辑工单申请
export function editWorkApplyApi(data) {
  return request({
    url: "/system/MaintenanceApply/edit",
    method: "post",
    data,
  });
}

// 获取工单申请详情
export function getWorkApplyDetailApi(workOrderId) {
  return request({
    url: `/system/MaintenanceApply/getInfo`,
    method: "get",
    params: { workOrderId },
  });
}

// 获取工单任务详情
export function getWorkTaskDetailApi(workOrderId) {
  return request({
    url: `/system/MaintenanceApply/selectMainTaskDetail`,
    method: "get",
    params: { workOrderId },
  });
}

// 获取工单任务申请物料回显
export function getWorkMaterialDetailApi(workOrderId) {
  return request({
    url: `/system/MaintenanceApply/selectErpDekiveryApplyList`,
    method: "get",
    params: { workOrderId },
  });
}

// 删除请购
export function deleteWorkApplyApi(workOrderId) {
  return request({
    url: `/system/MaintenanceApply/remove`,
    method: "get",
    params: { workOrderId },
  });
}

// 审核工单
export function checkWorkApi(data) {
  return request({
    url: "/system/MaintenanceApply/checkMainOrderApply",
    method: "post",
    data,
  });
}

// 获取用户列表
export function getUserListApi(deptType) {
  return request({
    url: "/system/user/selectUserIList",
    method: "get",
    params: { deptType },
  });
}

// 根据责任人筛选查询表格
export function orderCntApi(data) {
  return request({
    url: "/system/workOrder/orderCnt",
    method: "post",
    data
  });
}

// 任务分配
export function allotListApi(data) {
  return request({
    url: "/system/workOrder/allot",
    method: "post",
    data
  });
}

// 个人任务
export function getOrderCntDtlApi(query) {
  return request({
    url: "/system/workOrder/orderCntDtl",
    method: "get",
    params: query
  });
}

// 工单详情
export function getInfoApi(query) {
  return request({
    url: "/system/workOrder/getInfo",
    method: "get",
    params: query
  });
}

// 工单分配
export function workAllotApi(data) {
  return request({
    url: "/system/MaintenanceApply/implMainSave",
    method: "post",
    data,
  });
}

// 日志查询
export function operateLogApi(data) {
  return request({
    url: "/system/operateLog/list",
    method: "post",
    data,
  });
}

// 获取名下任务
export function getUserTaskApi(userId) {
  return request({
    url: "/system/MaintenanceApply/findPeopelTasks",
    method: "get",
    params: { userId },
  });
}

// 工单退回任务
export function workReturnTaskApi(data) {
  return request({
    url: "/system/MaintenanceApply/backErpMainTask",
    method: "post",
    data,
  });
}

// 工单执行、提交任务
export function workSubmitTaskApi(data) {
  return request({
    url: "/system/MaintenanceApply/executeErpMainTask",
    method: "post",
    data,
  });
}

// 撤销工单
export function repealWorkApi(data) {
  return request({
    url: "/system/MaintenanceApply/saveCancel",
    method: "post",
    data,
  });
}


// 审核进度
export function selectAuditList(deliveryApplyId) {
  return request({
    url: `/system/MaintenanceApply/selectAuditList`,
    method: "get",
    params: { deliveryApplyId },
  });
}

// 获取项目点位
export function getPorjectPointListApi(projectId) {
  return request({
    url: `/system/MaintenanceApply/selectBuildList`,
    method: "get",
    params: { projectId },
  });
}

// 审核任务
export function checkProjectTaskApi(data) {
  return request({
    url: "/system/proTask/auditTask",
    method: "post",
    data,
  });
}

// 更新用户
export function updateUserListApi(data) {
  return request({
    url: "/system/workOrder/updateUserList",
    method: "post",
    data,
  });
}
